<?php
/**
 * @version		$Id: default.php 17109 2010-05-16 21:03:55Z severdia $
 * @package		Joomla.Administrator
 * @subpackage	com_content
 * @copyright	Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */

// no direct access
defined('_JEXEC') or die;

require_once JPATH_COMPONENT.'/helpers/ajaxwhois.php';
require_once JPATH_COMPONENT.'/helpers/html/ajaxwhois.php';

JHtml::_('behavior.tooltip');
JHtmlAjaxWhois::tipStyle();
$lists = $this->lists();

$listOrder	= $this->state->get('list.ordering');
$listDirn	= $this->state->get('list.direction');
?>
<form action="<?php echo JRoute::_('index.php?option=com_ajaxwhois&amp;view=extensions'); ?>" method="post" name="adminForm">
	<fieldset id="filter-bar">
      <table cellpadding="1" class="adminheading">
        <tr>
            <td class="right">
                <label class="filter-search-lbl" for="filter_title"><?php echo JText::_('COM_AJAXWHOIS_EXTENSION_FILTER_LABEL'); ?>:</label>
            </td>
            <td>
                <input class="short" type="text" name="filter_title" id="filter_title" value="<?php echo $this->state->get('filter.title'); ?>" title="<?php echo JText::_('COM_AJAXWHOIS_EXTENSION_SEARCH'); ?>" onchange="this.form.submit()" />
            </td>
            <td class="right">
                <label class="filter-search-lbl" for="filter_group"><?php echo JText::_('COM_AJAXWHOIS_GROUP_FILTER_LABEL'); ?>:</label>
            </td>
            <td>
                <input class="short" type="text" name="filter_group" id="filter_group" value="<?php echo $this->state->get('filter.group'); ?>" title="<?php echo JText::_('COM_AJAXWHOIS_GROUP_SEARCH'); ?>" onchange="this.form.submit()" />
            </td>
            <td class="right">
                <label class="filter-search-lbl" for="filter_category"><?php echo JText::_('COM_AJAXWHOIS_CATEGORY_FILTER_LABEL'); ?>:</label>
            </td>
            <td>
                <input class="medium" type="text" name="filter_category" id="filter_category" value="<?php echo $this->state->get('filter.category'); ?>" title="<?php echo JText::_('COM_AJAXWHOIS_CATEGORY_SEARCH'); ?>" onchange="this.form.submit()" />
            </td>
            <td class="right">
                <label class="filter-search-lbl" for="filter_description"><?php echo JText::_('COM_AJAXWHOIS_DESCRIPTION_FILTER_LABEL'); ?>:</label>
            </td>
            <td>
                <input class="long" type="text" name="filter_description" id="filter_description" value="<?php echo $this->state->get('filter.description'); ?>" title="<?php echo JText::_('COM_AJAXWHOIS_DESCRIPTION_SEARCH'); ?>" onchange="this.form.submit()" />
            </td>
        </tr>
        <tr>
            <td class="right">
              <label class="filter-search-lbl" for="filter_which"><?php echo JText::_( 'Show' ); ?>:</label>
            </td>
            <td colspan="3">
              <?php echo $lists['which']; ?>
            </td>
            <td class="right">
              <label class="filter-search-lbl" for="filter_continent"><?php echo JText::_( 'Continent' ); ?>:</label>
            </td>
            <td>
              <?php echo $lists['continent']; ?>
            </td>
            <td class="right">
              <label class="filter-search-lbl" for="filter_country"><?php echo JText::_( 'Country' ); ?>:</label>
            </td>
            <td>
              <?php echo $lists['country']; ?>
            </td>
        </tr>
      </table>
    </fieldset>
    <table class="adminlist">
        <thead>
            <tr>
                <th>
                    <input type="checkbox" name="toggle" value="" onclick="checkAll(this)" />
                </th>
                <th>
                    <?php echo JHTML::_('grid.sort',   'Extension', 'a.title', $listDirn, $listOrder ); ?>
                </th>
                <th>
                    <?php echo JHTML::_('grid.sort',   'Price', 'a.price', $listDirn, $listOrder ); ?>
                </th>
                <th>
                    <?php echo JHTML::_('grid.sort',   'ByePass', 'a.byePass', $listDirn, $listOrder ); ?>
                </th>
                <th>
                    <?php echo JHTML::_('grid.sort',   'Group', 'a.extGroup', $listDirn, $listOrder ); ?>
                </th>
                <th>
                    <?php echo JHTML::_('grid.sort',   'Category', 'a.extCat', $listDirn, $listOrder ); ?>
                </th>
                <th>
                    <?php echo JHTML::_('grid.sort',   'Description', 'a.description', $listDirn, $listOrder ); ?>
                </th>
                <th>
                    <?php echo JHTML::_('grid.sort',   'Continent', 'a.continent', $listDirn, $listOrder ); ?>
                </th>
                <th>
                    <?php echo JText::_( 'Flag' ); ?>
                </th>
                <th>
                    <?php echo JHTML::_('grid.sort',   'Country', 'a.country', $listDirn, $listOrder ); ?>
                </th>
                <th colspan="2">
                    <?php echo JHTML::_('grid.sort',   'In Component', 'a.incomponent', $listDirn, $listOrder ); ?>
                </th>
                <th colspan="2"><?php echo JText::_( 'Checked' ); ?></th>
                <th>
                    <?php echo JHTML::_('grid.sort',   'Order', 'a.orderingc', $listDirn, $listOrder ); ?>
                    <?php echo JHtml::_('grid.order',  $this->items, 'filesave.png', 'extensions.saveorderc'); ?>
                </th>
                <th colspan="2">
                    <?php echo JHTML::_('grid.sort',   'In Module', 'a.inmodule', $listDirn, $listOrder ); ?>
                </th>
                <th colspan="2"><?php echo JText::_( 'Checked' ); ?></th>
                <th>
                    <?php echo JHTML::_('grid.sort',   'Order', 'a.ordering', $listDirn, $listOrder ); ?>
                    <?php echo JHtml::_('grid.order',  $this->items, 'filesave.png', 'extensions.saveorder'); ?>
                </th>
                <th>
                    <?php echo JText::_( 'Published' ); ?>
                </th>
                <th>
                    <?php echo JText::_( 'ID' ); ?>
                </th>
            </tr>
        </thead>
        <tfoot>
            <tr>
                <td colspan="23"><?php echo $this->pagination->getListFooter(); ?></td>
            </tr>
        </tfoot>
        <tbody>
		<?php foreach ($this->items as $i => $item) :
            $item->max_ordering = 0; //??
			$ordering = ($listOrder == 'a.ordering' || $listOrder == 'a.orderingc' || $listOrder == '');
            ?>
            <tr class="row<?php echo $i % 2; ?>">
                <td class="center">
                    <?php echo JHtml::_('grid.id', $i, $item->id); ?>
                </td>
                <td>
                    <a href="<?php echo JRoute::_('index.php?option=com_ajaxwhois&task=extension.edit&id='.$item->id);?>">
                        <?php echo $this->escape($item->title); ?>
                    </a>
                </td>
                <td>
                    <?php echo $item->price; ?>
                </td>
                <td class="center">
                    <a title="<?php echo JText::_($item->byePass?"Don't Bye Pass Extension":"Bye Pass Extension"); ?>" onclick="return listItemTask('cb<?php echo $i; ?>','extensions.<?php echo $item->byePass?"un":""; ?>byepass')" href="javascript:void(0);" class="jgrid"><span class="state <?php echo $item->byePass?"":"un"; ?>publish"><span class="text"><?php echo JText::_($item->byePass?"Bye Pass":"Don't Bye Pass"); ?></span></span></a>
                </td>
                <td>
                    <?php echo $item->extGroup; ?>
                </td>
                <td>
                    <?php echo $item->extCat; ?>
                </td>
                <td>
                    <?php echo substr($item->description,0,15).(strlen($item->description)>15?'...':''); ?>
                </td>
                <td>
                    <?php echo $item->continent; ?>
                </td>
                <td style="padding-left:8px">
                    <span class="flag <?php echo $item->flag; ?>"></span>
                </td>
                <td>
                    <?php echo $item->country; ?>
                </td>
                <td class="center" colspan="2">
                    <a title="<?php echo JText::_($item->incomponent?"Unpublish this Extension in Component":"Publish this Extension in Component"); ?>" onclick="return listItemTask('cb<?php echo $i; ?>','extensions.<?php echo $item->incomponent?"not":""; ?>incomponent')" href="javascript:void(0);" class="jgrid"><span class="state <?php echo $item->incomponent?"":"un"; ?>publish"><span class="text"><?php echo JText::_($item->incomponent?"Published In Component":"Not Published in Component"); ?></span></span></a>
                </td>
                <td class="center" colspan="2">
                    <a title="<?php echo JText::_($item->checkedc?"Extension Checked in Component":"Uncheck Extension in Component"); ?>" onclick="return listItemTask('cb<?php echo $i; ?>','extensions.<?php echo $item->checkedc?"un":""; ?>checkedc')" href="javascript:void(0);" class="jgrid"><span class="state <?php echo $item->checkedc?"":"un"; ?>publish"><span class="text"><?php echo JText::_($item->checkedc?"Checked in Module":"Not Checked in Module"); ?></span></span></a>
                </td>
                <td class="center">
                    <?php $disabled =  $ordering ?  '' : 'disabled="disabled"'; ?>
                    <input type="text" name="orderc[]" size="5" value="<?php echo $item->orderingc;?>" <?php echo $disabled ?> class="text-area-order" />
                </td>
                <td class="center" colspan="2">
                    <a title="<?php echo JText::_($item->inmodule?"Unpublish this Extension in Module":"Publish this Extension in Module"); ?>" onclick="return listItemTask('cb<?php echo $i; ?>','extensions.<?php echo $item->inmodule?"not":""; ?>inmodule')" href="javascript:void(0);" class="jgrid"><span class="state <?php echo $item->inmodule?"":"un"; ?>publish"><span class="text"><?php echo JText::_($item->inmodule?"Published In Module":"Not Published in Module"); ?></span></span></a>
                </td>
                <td class="center" colspan="2">
                    <a title="<?php echo JText::_($item->checked?"Extension Checked in Module":"Uncheck Extension in Module"); ?>" onclick="return listItemTask('cb<?php echo $i; ?>','extensions.<?php echo $item->checked?"un":""; ?>checked')" href="javascript:void(0);" class="jgrid"><span class="state <?php echo $item->checked?"":"un"; ?>publish"><span class="text"><?php echo JText::_($item->checked?"Checked":"Not Checked"); ?></span></span></a>
                </td>
                <td class="center">
                    <?php $disabled =  $ordering ?  '' : 'disabled="disabled"'; ?>
                    <input type="text" name="order[]" size="5" value="<?php echo $item->ordering;?>" <?php echo $disabled ?> class="text-area-order" />
                </td>
                <td class="center">
                    <?php echo JHtml::_('jgrid.published', $item->published, $i, 'extensions.', true); ?>
                </td>
                <td class="center">
                    <?php echo (int) $item->id; ?>
                </td>
            </tr>
        <?php endforeach; ?>
        </tbody>
    </table>

	<input type="hidden" name="task" value="" />
	<input type="hidden" name="boxchecked" value="0" />
	<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
	<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
	<?php echo JHtml::_('form.token'); ?>
</form>
